Wilson@思源
目 录
Sprig Function Documentation
The Sprig library provides over 70 template functions for Go’s template language.
String Functions
:
trim
,
wrap
,
randAlpha
,
plural
, etc.
String List Functions
:
splitList
,
sortAlpha
, etc.
Integer Math Functions
:
add
,
max
,
mul
, etc.
Integer Slice Functions
:
until
,
untilStep
Float Math Functions
:
addf
,
maxf
,
mulf
, etc.
Date Functions
:
now
,
date
, etc.
Defaults Functions
:
default
,
empty
,
coalesce
,
fromJson
,
toJson
,
toPrettyJson
,
toRawJson
,
ternary
Encoding Functions
:
b64enc
,
b64dec
, etc.
Lists and List Functions
:
list
,
first
,
uniq
, etc.
Dictionaries and Dict Functions
:
get
,
set
,
dict
,
hasKey
,
pluck
,
dig
,
deepCopy
, etc.
Type Conversion Functions
:
atoi
,
int64
,
toString
, etc.
Path and Filepath Functions
:
base
,
dir
,
ext
,
clean
,
isAbs
,
osBase
,
osDir
,
osExt
,
osClean
,
osIsAbs
Flow Control Functions
:
fail
Advanced Functions
UUID Functions
:
uuidv4
OS Functions
:
env
,
expandenv
Version Comparison Functions
:
semver
,
semverCompare
Reflection
:
typeOf
,
kindIs
,
typeIsLike
, etc.
Cryptographic and Security Functions
:
derivePassword
,
sha256sum
,
genPrivateKey
, etc.
Network
:
getHostByName